package commons.baseServlet;

/**
 * commons.baseServlet
 * User: 坚持
 * Date: 2024/12/24 10:45
 * motto: 树欲静而风不止
 * Description:
 * Version: V1.0
 */
public class UrlUtils {
    public static String getUrl(String url) {
        /*检查路径是否为空*/
        if (url == null || url.trim().isEmpty())
            return null;
        /*检查路径是否为正斜杠结尾*/
        int index = url.lastIndexOf("/");
        /*检查路径是否为反斜杠结尾的*/
        if (index == -1){
            index = url.lastIndexOf("\\");
        }
        /*返回文件的点路径*/
        return url.substring(index + 1);
    }
}
